package zhuyun.code.launcheractivity

import android.app.Application
import android.provider.ContactsContract.CommonDataKinds.Note
import cn.renyuzhuo.viewer.ObjectViewBoxManager
import com.facebook.stetho.Stetho
import com.facebook.stetho.okhttp3.StethoInterceptor
import io.objectbox.BoxStore
import okhttp3.OkHttpClient
import zhuyun.code.launcheractivity.model.db.DBB2CSearchHistory
import zhuyun.code.launcheractivity.model.db.MyObjectBox
import zhuyun.code.launcheractivity.model.db.UserInfo


/**
 * @author: Administrator
 * @date: 2021/11/17
 */
class App:Application() {
    val boxStore: BoxStore by lazy { 
        MyObjectBox.builder().androidContext(this).build()
    }

    companion object{
        lateinit var context: App

    }




    override fun onCreate() {
        super.onCreate()
        context = this
        val classes: ArrayList<Class<*>> = ArrayList()
        classes.add(DBB2CSearchHistory::class.java) // Your Entitys
        classes.add(UserInfo::class.java)
        ObjectViewBoxManager.getInstance().init(boxStore, classes)
        Stetho.initializeWithDefaults(this)
        OkHttpClient.Builder()
            .addNetworkInterceptor(StethoInterceptor())
            .build()


    }
}